From 8fcf1b78a44963d2251857a255e9c2d04d426e7a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Timm=20B=C3=A4der?= Date: Sun, 21 Jun 2020 08:31:24 +0200 Subject: [PATCH] renderbackground: Only query h/vrepeat if we need to --- gtk/gtkrenderbackground.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/gtk/gtkrenderbackground.c b/gtk/gtkrenderbackground.c index fb17730900..11c9c109c6 100644 --- a/gtk/gtkrenderbackground.c +++ b/gtk/gtkrenderbackground.c @@ -94,9 +94,6 @@ gtk_theming_background_snapshot_layer (GtkCssBoxes *bg, pos = _gtk_css_array_value_get_nth (background->background_position, idx); repeat = _gtk_css_array_value_get_nth (background->background_repeat, idx); - hrepeat = _gtk_css_background_repeat_value_get_x (repeat); - vrepeat = _gtk_css_background_repeat_value_get_y (repeat); - origin = gtk_css_boxes_get_box (bg, _gtk_css_area_value_get ( @@ -125,8 +122,13 @@ gtk_theming_background_snapshot_layer (GtkCssBoxes *bg, /* optimization */ if (image_width == width) hrepeat = GTK_CSS_REPEAT_STYLE_NO_REPEAT; + else + hrepeat = _gtk_css_background_repeat_value_get_x (repeat); + if (image_height == height) vrepeat = GTK_CSS_REPEAT_STYLE_NO_REPEAT; + else + vrepeat = _gtk_css_background_repeat_value_get_y (repeat); gtk_snapshot_push_debug (snapshot, "Layer %u", idx); gtk_snapshot_push_rounded_clip (snapshot, clip); -- 2.30.2